import siteService from '../../services/site'
import * as types from '../mutation-types'
// initial state
const state = {
  siteTree: {}

}

// getters
const getters = {

}

// actions
const actions = {
  loadSiteTree({commit},params) {
    return new Promise((resolve,reject) =>{
      siteService.loadSiteTreeServer(params, (data) =>{
        commit(types.LOAD_SITETREE,data);
        resolve(data);
      });
    })
  }
}

// mutations
const mutations = {
  [types.LOAD_SITETREE] (state, data) {
    state.siteTree = data.data;
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
